<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>选择器</title>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
	<script>
		
		$(function () {


			function run() {
				
				if($('.box').position().left=='0'){
					$('.box').animate({'left': '1000'}, 1000)
				}else{
					$('.box').animate({'left': '0'}, 1000)
				}
			}
			setInterval(run,2000)

			// $('input').click(function(event) {
			// 	$('.box').animate({'left': '1000'}, 5000)
			// });

			// $('span').hover(function() {
			// 	$('.box').slideToggle();
			// }, function() {
			// 	$('.box').slideToggle();
			// });
		})

	</script>
	<style>
		*{
			margin: 0px;
			padding: 0px;
		}
		.box{
			width: 200px;
			height: 200px;
			background: red url() 0 0 no-repeat;
			position: relative;
			top: 0px;
			left: 0px;
		}
	</style>
</head>
<body>
	<input type="button" value="点我">
	<span>购物车</span>
	<div class="box">
		
	</div>
</body>
</html>